package com.example.mallorder.controller;

import com.example.mallorder.api.domain.Order;
import com.example.mallorder.api.service.OrderService;
import com.example.mallorder.feign.OrderFeign;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/** @author yangtao */
@Api(tags = "订单控制器")
@RestController
public class OrderController implements OrderFeign{
  @Autowired private OrderService orderService;

  @ApiOperation(value = "下单")
  @ApiImplicitParam(name = "pid",value = "产品编码", required = true,paramType = "path")
  @Override
  @RequestMapping(value="/order/prod/{pid}",method = RequestMethod.GET)
  public Order createOrder(@PathVariable("pid") Integer pid) {
    return orderService.createOrder(pid);
  }

}
